#! /bin/sh
#
# suktmig2d-offset - Prestack time migration of a common-offset section
# Copyright (C) 2010 Reynam Pestana CPGG/UFBA <reynam@cpgg.ufba.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# This script is based on a similar one distributed by 
# Jack Cohen, John Stockwell - 03/94

WIDTH=400
HEIGHT=350
WIDTHOFF1=0
WIDTHOFF2=640
HEIGHTOFF1=50
HEIGHTOFF2=530

# Remark: Since synlv puts 10^3 in header fields internally,
#         use kilo_units in distances and velocities

# Common parameters
#-----------------------------------------------------------------------------

v00=3.5     # P-wave velocity at surface
dvdx=0.0    # velocity gradient (dv/dx)
dvdz=.0     # velocity gradient (dv/dz)
nt=512 
dt=0.004
fpeak=25.0  # should be <= half nyquist to avoid spatial aliasing

# Common Offset Section generated by subsetting common shot gathers
#-----------------------------------------------------------------------------

# ref="1:1,2;4,2"  reflector(s):  "amplitude:x1,z1;x2,z2;x3,z3;..."
REF1="1.0:0.0,0.25;4.2,0.25"
REF2="2.0:0.0,0.5;1.0,0.5"
REF3="3.0:1.0,0.5;3.0,1.0;4.2,1.0"
REF4="4.0:1.0,0.5;2.5,1.5;4.2,1.5"
REF5="5.0:1.0,0.5;2.0,2.0;4.2,2.0"
REF6="6.0:1.0,0.5;1.5,2.5;4.2,2.5"
REF7="7.0:1.0,0.5;1.0,3.0,4.2,3.0"

nxo=64  fxo=.0 dxo=0.02   # offset information: number, first, spacing
nxs=128 fxs=.0 dxs=0.02   # shot information: number, first, spacing
ob=0  	 		  # to eliminate the turned ray contribution

echo "Building the SU input data"

susynlv nt=$nt dt=$dt verbose=0                                     \
        ref=$REF1 ref=$REF2 ref=$REF3 ref=$REF4                     \
        ref=$REF5 ref=$REF6 ref=$REF7                               \
        nxo=$nxo  fxo=$fxo  dxo=$dxo                                \
        nxs=$nxs  fxs=$fxs  dxs=$dxs                                \
        ob=$ob fpeak=$fpeak ndpfz=10 v00=$v00 dvdx=$dvdx dvdz=$dvdz |
sushw   key=offset a=0 b=20 j=64                                    |
suchw   key1=cdp key2=sx key3=gx a=20 b=1 c=1 d=20                  |
susort  offset cdp                                                  \
> synt-off.su

echo "Building the velocity model"

makevel nx=318 nz=512 v000=3500 > velxz.bin 

exit 0

